﻿<%@ Page Title="" Language="C#" MasterPageFile="~/rightContent.Master" AutoEventWireup="true"
    CodeBehind="cost.aspx.cs" Inherits="WEB.T_bill.cost"MaintainScrollPositionOnPostback="true"  %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style3
        {
            text-align: center;
        }
        .style5
        {
            width: 235px;
        }
        .style7
        {
            height: 28px;
            text-align: center;
        }
        .style8
        {
            width: 865px;
        }
        .style9
        {
            width: 478px;
            font-weight: bold;
        }
        .style10
        {
            width: 238px;
            font-weight: bold;
        }
        .style11
        {
            text-align: right;
        }
        .style12
        {
            width: 210px;
            height: 32px;
        }
        .style13
        {
            width: 257px;
            height: 32px;
        }
        .style14
        {
            width: 200px;
            height: 32px;
        }
        .style15
        {
        }
        .style16
        {
            height: 32px;
        }
        .style17
        {
            width: 169px;
            height: 33px;
        }
        .style18
        {
            width: 200px;
            height: 33px;
        }
        .style19
        {
            width: 210px;
            height: 33px;
        }
        .style20
        {
            width: 257px;
            height: 33px;
        }
        .style21
        {
            height: 32px;
            width: 169px;
        }
        .style22
        {
            width: 169px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="title" runat="server">
    费用录入
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    <table style="width: 100%;">
        <tr>
            <td colspan="4" align="center">
                <table cellpadding="5" cellspacing="5" 
                    style="width: 902px; margin-right: 35px;">
                    <tr>
                        <td align="center" class="style17">
                            <asp:Label ID="sheetID" runat="server" Text="委托单号："></asp:Label>
                            <asp:Label ID="lbsheetID" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style18">
                            <asp:Label ID="clID" runat="server" Text="客户公司:"></asp:Label>
                            <asp:Label ID="lblCID" runat="server"> </asp:Label>
                        </td>
                        <td align="center" class="style19">
                            合同号：<asp:Label ID="lbHTH" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style20">
                            <asp:Label ID="ladingBillNO" runat="server" Text="提单号:"></asp:Label>
                            <asp:Label ID="lbladingBillNO" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="style21">
                            <asp:Label ID="agencyDate" runat="server" Text="日期:"></asp:Label>
                            <asp:Label ID="lbagencyDate" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style14">
                            <asp:Label ID="goodsName" runat="server" Text="货名:"></asp:Label>
                            <asp:Label ID="lbgoodsName" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style12">
                            集装箱量：<asp:Label ID="lbJZXL" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style13">
                            <asp:Label ID="shipName" runat="server" Text="船名:"></asp:Label>
                            <asp:Label ID="lbshipName" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" class="style21">
                            货物类型：<asp:Label ID="lb_HWLX" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style14">
                            类型：<asp:Label ID="lb_LX" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style12">
                            进出口：<asp:Label ID="lb_JCK" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style13">
                            危险品：<asp:Label ID="lb_WXP" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td class="style22">
                            贸易方式：<asp:Label ID="lb_MYFS" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style16" colspan="3">
                            报关单号：<asp:Label ID="lb_BGDH" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td class="style22">
                            报检号：<asp:Label ID="lb_BJH" runat="server"></asp:Label>
                        </td>
                        <td align="center" class="style15" colspan="3">
                            集装箱号：<asp:Label ID="lbJZXH" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            &nbsp;</td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="4" align="center">
                <table cellpadding="5" cellspacing="5" style="width: 900px">
                    <tr>
                        <td align="left" class="style9">
                            应收录入：
                        </td>
                        <td>
                        </td>
                        <td align="right">
                            模板：
                            <asp:DropDownList ID="ddlreceivables" runat="server" AppendDataBoundItems="True"
                                AutoPostBack="True" OnSelectedIndexChanged="ddlTemplate_SelectedIndexChanged">
                                <asp:ListItem Value="0">———请选择———</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <tr>
                            <td align="center" class="style8" colspan="3">
                                <asp:GridView ID="gvReceivables" runat="server" AutoGenerateColumns="False" BackColor="White"
                                    BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black"
                                    GridLines="Vertical" Width="900px" OnRowCommand="gvReceivables_RowCommand">
                                    <AlternatingRowStyle BackColor="White" />
                                    <Columns>
                                        <asp:TemplateField HeaderText="序号" InsertVisible="False">
                                            <ItemStyle HorizontalAlign="Center" />
                                            <HeaderStyle HorizontalAlign="Center" Width="5%" />
                                            <ItemTemplate>
                                                <%#Container.DataItemIndex+1%>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="费用类别">
                                            <ItemTemplate>
                                                <asp:DropDownList ID="ddlfeeTypeID" AppendDataBoundItems="True" runat="server" DataSource='<%# GetFeeType() %>'
                                                    DataTextField="feeName" DataValueField="feeTypeNo" 
                                                    SelectedValue='<%# Eval("feeTypeID") %>'>
                                                    <asp:ListItem Value="0">---请选择---</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="费用金额">
                                            <FooterTemplate>
                                                <asp:Label ID="Label5" runat="server"></asp:Label>
                                            </FooterTemplate>
                                            <ItemTemplate>
                                                <asp:TextBox ID="tbfeeAmount" Style="text-align: right" Text='<%# Eval("sfeeAmount") %>'
                                                    onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')"
                                                    runat="server" MaxLength="13" 
                                                    OnTextChanged="tbfeeAmount_TextChanged1"></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="结算方式">
                                            <EditItemTemplate>
                                                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                            </EditItemTemplate>
                                            <ItemTemplate>
                                                <asp:DropDownList ID="ddl_Rec_js" runat="server" 
                                                    SelectedValue='<%# Eval("checkOut") %>'>
                                                    <asp:ListItem Value="1">包干</asp:ListItem>
                                                    <asp:ListItem Value="2">代收代付</asp:ListItem>
                                                    <asp:ListItem Value="3">其他</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="发票类型">
                                            <ItemTemplate>
                                                <asp:DropDownList ID="DropDownList1" runat="server" SelectedValue='<%# Eval("invType") %>'>
                                                    <asp:ListItem Value="1">普通发票</asp:ListItem>
                                                    <asp:ListItem Value="2">专用发票</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="发票号">
                                            <ItemTemplate>
                                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("invNo") %>'></asp:TextBox>
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="付款方式">
                                            <ItemTemplate>
                                                <asp:DropDownList ID="DropDownList2" runat="server" 
                                                    SelectedValue='<%# Eval("payType") %>'>
                                                    <asp:ListItem Value="2">转账</asp:ListItem>
                                                    <asp:ListItem Value="1">现金</asp:ListItem>
                                                </asp:DropDownList>
                                            </ItemTemplate>
                                            <HeaderStyle Wrap="False" />
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="备注">
                                            <ItemTemplate>
                                                <asp:TextBox ID="tbremark" runat="server" Text='<%# Eval("remark") %>' 
                                                    MaxLength="200"></asp:TextBox>
                                                <asp:HiddenField ID="hfpayedID" runat="server" Value='<%#Eval("payedID") %>' />
                                                <asp:HiddenField ID="hfauditEmpID" runat="server" Value='<%#Eval("auditEmpID") %>' />
                                                <asp:HiddenField ID="hfafeeAmount" runat="server" Value='<%#Eval("afeeAmount") %>' />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="转应付">
                                            <ItemTemplate>
                                                <asp:Button ID="btn_Topay" runat="server" CausesValidation="False" Text="转应付" CommandArgument='<%# Container.DataItemIndex %>'
                                                    CommandName="toPay" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                    <FooterStyle BackColor="#CCCC99" />
                                    <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                                    <RowStyle BackColor="#F7F7DE" />
                                    <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                                    <SortedAscendingCellStyle BackColor="#FBFBF2" />
                                    <SortedAscendingHeaderStyle BackColor="#848384" />
                                    <SortedDescendingCellStyle BackColor="#EAEAD3" />
                                    <SortedDescendingHeaderStyle BackColor="#575357" />
                                    <SortedAscendingCellStyle BackColor="#F8FAFA"></SortedAscendingCellStyle>
                                    <SortedAscendingHeaderStyle BackColor="#246B61"></SortedAscendingHeaderStyle>
                                    <SortedDescendingCellStyle BackColor="#D4DFE1"></SortedDescendingCellStyle>
                                    <SortedDescendingHeaderStyle BackColor="#15524A"></SortedDescendingHeaderStyle>
                                </asp:GridView>
                            </td>
                        </tr>
                    </tr>
                </table>
            </td>
        </tr>
            
                <tr>
                    <td class="style7">
                        包干普通发票合计（含税）：<asp:Label ID="lb_Rec_Baopu" runat="server"></asp:Label>
                    </td>
                    <td class="style7" colspan="3">
                        包干专用发票合计：<asp:Label ID="lb_Rec_Baozhuan" runat="server"></asp:Label>
                    </td>
                </tr>
        </tr>
        <tr>
            <td align="center" class="style3">
                代收代付普通发票合计（含税）：<asp:Label ID="lb_Rec_Daipu" runat="server"></asp:Label>
            </td>
            <td align="center" class="style3" colspan="3">
                代收代付专用发票合计：<asp:Label ID="lb_Rec_Daizhuan" runat="server"></asp:Label>
            </td>
        </tr>
        <tr>
            <td align="center" class="style3">
                &nbsp;</td>
            <td align="center" class="style3" colspan="3">
                &nbsp;</td>
        </tr>
        <tr>
            <td align="center" class="style3" colspan="3">
                <asp:Button ID="btn_Rec_Save" runat="server" Text="保存" OnClick="btn_Rec_Save_Click" />
                        <asp:Button ID="btn_Rec_AddRow" runat="server" Text="添加一行" OnClick="btnAddRow_Click"
                            Style="text-align: center" Width="102px" />
            </td>
            <td align="center" class="style5">
                应收金额合计：<asp:Label ID="lb_Rec_money" runat="server" Style="font-weight: 700"></asp:Label>
            </td>
        </tr>
        </tr>
        <tr>
            <td class="style3" colspan="3">
            </td>
        </tr>
            <td colspan="4" align="center">
                <table cellpadding="5" cellspacing="5" style="width: 900px; margin-left: 0px;">
                <tr>
                <td align="left" class="style10">
                    应付录入：
                    </td>
                    <td>
                    </td>
                    <td class="style11">
                        模版：&nbsp;
                 <asp:DropDownList ID="ddlPayment" runat="server" AppendDataBoundItems="True" AutoPostBack="True"
                    OnSelectedIndexChanged="ddlTemplate_SelectedIndexChanged_Pay">
                    <asp:ListItem Value="0">———请选择———</asp:ListItem>
                </asp:DropDownList>
                    </td>
                    <tr>
                    <td colspan="3" align="center">
                    <asp:GridView ID="gvPayment" runat="server" AutoGenerateColumns="False" BackColor="White"
                        BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" ForeColor="Black"
                        GridLines="Vertical" Width="900px">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:TemplateField HeaderText="序号" InsertVisible="False">
                                <ItemStyle HorizontalAlign="Center" />
                                <HeaderStyle HorizontalAlign="Center" Width="5%" />
                                <ItemTemplate>
                                    <%#Container.DataItemIndex+1%>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="费用类别">
                                <ItemTemplate>
                                    <asp:DropDownList ID="ddlfeeTypeID" runat="server" DataTextField="feeName" DataValueField="feeTypeNo"
                                        SelectedValue='<%# Eval("feeTypeID") %>' AppendDataBoundItems="True" DataSource="<%# GetFeeType() %>">
                                        <asp:ListItem Value="0">---请选择---</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="费用金额">
                                <ItemTemplate>
                                    <asp:TextBox ID="tbfeeAmount" Style="text-align: right" Text='<%# Eval("sfeeAmount") %>'
                                        onkeyup="if(isNaN(value))execCommand('undo')" onafterpaste="if(isNaN(value))execCommand('undo')"
                                        runat="server" MaxLength="13" OnTextChanged="tbfeeAmount_TextChanged"></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="结算方式">
                                <ItemTemplate>
                                    <asp:DropDownList ID="ddl_Pay_js" runat="server" 
                                        SelectedValue='<%# Eval("checkOut") %>'>
                                        <asp:ListItem Value="1">包干</asp:ListItem>
                                        <asp:ListItem Value="2">代收代付</asp:ListItem>
                                        <asp:ListItem Value="3">其他</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="发票类型">
                                <ItemTemplate>
                                    <asp:DropDownList ID="DropDownList3" runat="server" SelectedValue='<%# Eval("invType") %>'>
                                        <asp:ListItem Value="1">普通发票</asp:ListItem>
                                        <asp:ListItem Value="2">专用发票</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="发票号">
                                <ItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Eval("invNo") %>'></asp:TextBox>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="付款方式">
                                <ItemTemplate>
                                    <asp:DropDownList ID="DropDownList4" runat="server" 
                                        SelectedValue='<%# Eval("payType") %>'>
                                        <asp:ListItem Value="1">现金</asp:ListItem>
                                        <asp:ListItem Value="2">转账</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                                <HeaderStyle Wrap="False" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="备注">
                                <ItemTemplate>
                                    <asp:TextBox ID="tbremark" runat="server" Text='<%# Eval("remark") %>' MaxLength="200"></asp:TextBox>
                                    <asp:HiddenField ID="hfpayedID" runat="server" Value='<%#Eval("payedID") %>' />
                                    <asp:HiddenField ID="hfauditEmpID" runat="server" Value='<%#Eval("auditEmpID") %>' />
                                    <asp:HiddenField ID="hfafeeAmount" runat="server" Value='<%#Eval("afeeAmount") %>' />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle BackColor="#CCCC99" />
                        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                        <RowStyle BackColor="#F7F7DE" />
                        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                        <SortedAscendingCellStyle BackColor="#FBFBF2" />
                        <SortedAscendingHeaderStyle BackColor="#848384" />
                        <SortedDescendingCellStyle BackColor="#EAEAD3" />
                        <SortedDescendingHeaderStyle BackColor="#575357" />
                        <SortedAscendingCellStyle BackColor="#F8FAFA"></SortedAscendingCellStyle>
                        <SortedAscendingHeaderStyle BackColor="#246B61"></SortedAscendingHeaderStyle>
                        <SortedDescendingCellStyle BackColor="#D4DFE1"></SortedDescendingCellStyle>
                        <SortedDescendingHeaderStyle BackColor="#15524A"></SortedDescendingHeaderStyle>
                    </asp:GridView>
                    </tr>
                    </td>
                </tr>
                </table> 
                </td> 
            <tr>
                <td align="center" colspan="2">
                    包干普通发票合计（含税）：<asp:Label ID="lb_Pay_Baopu" runat="server"></asp:Label>
                    <br />
                    <td align="center" colspan="2">
                        包干专用发票合计：<asp:Label ID="lb_Pay_Baozhuan" runat="server"></asp:Label>
                <tr>
                        <td class="style3">
                            代收代付普通发票合计（含税）：<asp:Label ID="lb_Pay_Daipu" runat="server"></asp:Label>
                        </td>
                        <td class="style3" colspan="3">
                            代收代付专用发票合计：<asp:Label ID="lb_Pay_Daizhuan" runat="server"></asp:Label>
                        </td>
                    </tr>
                </td>
            </tr>
            <td align="center" class="style3">
                &nbsp;</td>
            <td align="center" class="style3" colspan="2">
                &nbsp;</td>
            <td align="center" class="style5">
                &nbsp;</td>
            <tr>
                <td align="center" class="style3" colspan="3">
                    <asp:Button ID="btn_Pay_Save" runat="server" Text="保存" OnClick="btn_Pay_Save_Click" />
                            <asp:Button ID="btn_Pay_AddRow" runat="server" Text="添加一行" OnClick="btnAddRow_Pay_Click"
                                Width="102px" Style="text-align: center" />
                </td>
                <td align="center" class="style5">
                    应付金额合计：<asp:Label ID="lb_Pay_money" runat="server" Style="text-align: left; font-weight: 700;"></asp:Label>
                </td>
            </tr>
    </table>
    <br />
</asp:Content>
